<!--
 * Created by PhpStorm.
 * 版权所有: 2019~2022 [ hhygyl ]
 * Date: 2019/7/9-17:30
 * Link: http://luckyadmin.luckyhhy.cn
 * FileName: edit_navigate.html
 *-->


{include file="public/open_head" /}

<div class="ok-body">

    <div class="layui-fluid">
        <div class="layui-card">
            <!-- <div class="layui-card-header"></div>-->

            <div class="layui-card-body" style="padding: 15px;">
                <form class="layui-form" action="" lay-filter="component-form-group">

                    <div class="layui-form-item">
                        <label class="layui-form-label">上级栏目：</label>
                        <div class="layui-input-block">

                            <select name="pid" lay-search="">
                                <option value="0" {eq name="$pid" value="0"} selected {/eq}>顶级栏目</option>
                                {volist name="tree" id="t"}
                                <option value="{$t.id}" {eq name="$pid" value="$t.id"} selected {/eq}>{$t.title_show}</option>
                                {/volist}
                            </select>

                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">选择模型：</label>
                        <div class="layui-input-block">

                            {:widget('forms/singleSelect',array('model_id|1|模型|name|id',$model,$info.model_id))}

                        </div>
                    </div>

                    <input type="hidden" name="id" value="{$info.id}">

                    {:token()}

                    {lv:inputform  name="title"  value="$info.title"  place="请输入名称" label="栏目名称：" verify="required" class="name" /}

                    <div class="layui-form-item">
                        <label class="layui-form-label">图标类型：</label>
                        <div class="layui-input-block input-custom-width">
                            <input type="radio" name="fontFamily" value="layui-icon" title="layui图标" lay-filter="radio" >
                            <input type="radio" name="fontFamily" value="fa" title="font-awsome图标" lay-filter="radio"  checked>
                        </div>
                        <div class="layui-form-mid layui-word-aux"></div>
                    </div>

                    {lv:inputform  name="href"  value="$info.href"  place="请求地址" label="地址："  /}

                    <div class="layui-form-item layui-tubiao"  {eq name="$info.fontFamily" value="fa"} style="display:none;"  {/eq} >
                    <label class="layui-form-label">选择图标：</label>
                    <div class="layui-input-block input-custom-width">
                        <input type="text" name="layui-icon"  value="{$info.icon}"  id="iconFonts" placeholder="" lay-verify="" lay-verType="tips" lay-reqText=""  autocomplete="off"  class="layui-input">
                    </div>
                        <div class="layui-form-mid layui-word-aux layui-text " >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            {eq name="$info.fontFamily" value="layui-icon"}
                           <i class="layui-icon {$info.icon}"></i>
                            {/eq}
                    </div>
                    </div>

                    <div class="layui-form-item font-tubiao"   {eq name="$info.fontFamily" value="layui-icon"} style="display:none;"   {/eq} >
                       <label class="layui-form-label">选择图标：</label>
                        <div class="layui-input-block input-custom-width">
                            <input type="text" name="fa"  value="{$info.icon}"  id="font-tubiao" placeholder="" lay-verify="" lay-verType="tips" lay-reqText=""  autocomplete="off"  class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux layui-text " >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            {eq name="$info.fontFamily" value="fa"}
                            <i class="fa {$info.icon}"></i>
                            {/eq}

                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">是否显示：</label>
                        <div class="layui-input-inline input-custom-width">
                            <input type="radio" name="status" value="1" title="显示" lay-filter="" {eq name="$info.status" value="1"} checked   {/eq}>
                            <input type="radio" name="status" value="2" title="隐藏" lay-filter=""  {eq name="$info.status" value="2"} checked   {/eq} >
                        </div>
                        <div class="layui-form-mid layui-word-aux"></div>
                    </div>

                     {lv:inputform  name="listorder" value="$info.listorder" type="number" place="排序" label="菜单排序："  lang="inline"  word="数字越大越靠前" /}


                        {:widget('forms/submit',array('add','保存提交'))}


                </form>
            </div>
        </div>
    </div>


</div>



<script>
    layui.use(['element', 'form', 'jquery','IconFonts','iconPicker','lucky'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var IconFonts = layui.IconFonts;
        var iconPicker=layui.iconPicker;
        var lucky=layui.lucky;
        //图标选择器
        iconPicker.render({
            // 选择器，推荐使用input
            elem: '#iconFonts',
            // 数据类型：fontClass/layui_icon，
            type: 'fontClass',
            // 是否开启搜索：true/false
            search: true,
            // 是否开启分页
            page: true,
            // 每页显示数量，默认12
            limit: 12,
            // 点击回调
            click: function (data) {
                //console.log(data);
            }
        });

        IconFonts.render({
            // 选择器，推荐使用input
            elem: '#font-tubiao',
            // 数据类型：fontClass/layui_icon，
            type: 'fontClass',
            // 是否开启搜索：true/false
            search: true,
            // 是否开启分页
            page: true,
            // 每页显示数量，默认12
            limit: 12,
            // 点击回调
            click: function (data) {
                //console.log(data);
            }
        });

        /**
         *
         */
        form.on("radio(radio)",function (data) {
            //console.log(data);
            if (data.value=="fa"){
                $(".layui-tubiao").hide(0);
                $(".font-tubiao").show(0);
            } else {
                $(".layui-tubiao").show(0);
                $(".font-tubiao").hide(0);
            }
        });


        /**
         * 数据提交
         */
        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('navigate/AddNavigate')}",data.field,"tableFilter",1);
            return false;
        });
    })
</script>


</body>
</html>
